package com.dc.controller;

import com.dc.annotation.Log;
import com.dc.entity.SparePartRelation;
import com.dc.entity.ro.SparePartRelationRO;
import com.dc.common.ResponseResultVO;
import com.dc.service.SparePartRelationService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;

@Api(tags = "备件出入库记录表管理")
@RestController
@RequestMapping("/sparePartRelation")
public class SparePartRelationController {

    @Resource
    private SparePartRelationService sparePartRelationService;


    @Log(title = "备件出入库管理", businessDesc = "出入库")
    @ApiOperation(value = "增加", notes = "增加")
    @PostMapping("/insertSparePartRelation")
    public ResponseResultVO insertSparePartRelation(@RequestBody SparePartRelationRO ro) {
        return sparePartRelationService.insertSparePartRelation(ro);
    }


    @Log(title = "备件出入库管理", businessDesc = "修改")
    @ApiOperation(value = "修改", notes = "修改")
    @PostMapping("/updateSparePartRelation")
    public ResponseResultVO updateSparePartRelation(@RequestBody SparePartRelationRO ro) {
        return sparePartRelationService.updateSparePartRelation(ro);
    }


    @Log(title = "备件出入库管理", businessDesc = "删除")
    @ApiOperation(value = "删除", notes = "删除")
    @GetMapping("/deleteSparePartRelation")
    public ResponseResultVO deleteSparePartRelation(@RequestParam String id) {
        return sparePartRelationService.deleteSparePartRelation(id);
    }

    @ApiOperation(value = "查询列表", notes = "查询列表")
    @PostMapping("/selectSparePartRelationList")
    public ResponseResultVO<SparePartRelation> selectSparePartRelationList(@RequestBody SparePartRelationRO ro) {
        return sparePartRelationService.selectSparePartRelationList(ro);
    }

    @ApiOperation(value = "工单下拉查询", notes = "工单下拉查询")
    @GetMapping("/selectBillList")
    public ResponseResultVO<SparePartRelation> selectBillList(String type) {
        return sparePartRelationService.selectBillList(type);
    }
}
